<?php

require_once( '../../libs/smarty.inc' );

require_once( '../../libs/smt_variables.php' );

require_once( '../../libs/Class_DB.php' );

require_once( '../../libs/Class_ERROR.php' );

require_once( '../../libs/login.inc.php' );





if( isset( $_GET['id'] ) ){



	$db = new Class_DB;



	$sql = sprintf( "SELECT * FROM M_PRODUCTS WHERE category = %u ORDER BY pro_name",

				$_GET['id']

			);



	$db->query( $sql );

	

	$body = "{ id: '', name: '' },";

	while( $row = $db->fetch() ){

		$body .= "{ id: '" . $row['id'] . "', name: '" . htmlspecialchars( $row['pro_name'] ) . "' },";

	}

	$body = substr( $body, 0, strlen( $body ) -1 );



	header('Content-type: text/plain; charset=utf-8;');

	print "reloadProducts({\"services\":[";

	print $body;

	print "]})";



}



?>